<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
	<meta content="width=device-width,user-scalable=Yes,initial-scale=1.0" name="viewport" />
	<title>注册页</title>
	
	<link href="bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
	<link href="css/base.css" rel="stylesheet">
	
	<script src="jquery/2.1.1/jquery.min.js"></script>
	<script src="bootstrap/3.2.0/js/bootstrap.min.js"></script>
	<script src="layer/layer.js"></script>
	
	<style type="text/css">
	</style>

</head>
<body>
	<div class="mail-box">
	    <dl>
	        <dt class="text-success">您注册的电子邮箱<span class="" id="userEmail">${userName}</span></dt>
	        <dd>
	            <p>我们向您的邮箱发送了一份注册确认邮件，请登录邮箱进行验证。</p>
	
	            <a href="" data-email class="btn  btn-info" target="_blank">&nbsp;立即验证邮件&nbsp;</a>
	
	            <p><a href="javascript:;" onclick="sendEmail();" class="link">没收到？再次发送</a></p>
	        </dd>
	    </dl>
	</div>
</body>
<script type="text/javascript">
	$(function() {
		var userName = '${userName}';
        $("a[data-email]").attr("href", "http://mail." + userName.substring(userName.indexOf("@") + 1, userName.length));
	});
    function sendEmail() {
        var url = "regist/sendEmailAgain";
        var _email = "";
        if ($("#userEmail").length > 0) {
            _email = $("#userEmail").text();
        }
        $.ajax({
            url: url,
            type: "post",
            data: {
                "user.username": _email
            },
            dataType: "json",
            success: function (result) {
                if (result.status == 0) {
                    alert(result.msg);
                }
                if (result.status == 1) {
                    alert("邮件已发送至" + _email + ",请去邮箱根据提示完成验证");
                }
            }
        });
    }
</script>
</html>
